<?php
namespace Learn\Controller;
use Application\Controller\AbstractController;
use Zend\View\Model\ViewModel;
use Wistia\Account;
class IndexController extends AbstractController{
    public function indexAction(){
        $ssemail=$this->getAuthSession('email');   
        $acc = new Account('1cba2dd298c4cd5ffafd1b34d4e7ce5486029c0ec2846695bc0878bd116ee204');
        
        $project=$acc->getProjects();
        //print_r($project);
        $data=array();
        foreach ($project as $vds){
           // print_r($vds);exit();
          //$videos=$vds->getMedias();
           //print_r($tt->getPublicId());
           //print_r($videos);
           $video['module']=$vds->getName();
           $video['videos']=$vds->getMedias();
           $data[]=$video;
           
           
          
        //var_dump($a);exit;
        }
        return new ViewModel(array('module'=>$data,'email'=>$ssemail));
    }
    public function viewAction(){
        $request=$this->getRequest();
        //$hash_id = $request->getPost('hashed_id');
        //$this->_arrParam=$this->$request->getParams();
        if($request->isPost()) {
            $hash_id = $request->getPost('hash_id');
            $video_name = $request->getPost('name');
            $html = '<div id="wistia_' . $hash_id . '" class="wistia_embed" style="width:720px;height:405px;">&nbsp;</div>
                            <script>
                            wistiaEmbed = Wistia.embed("'. $hash_id .'", { 
                            autoPlay: true,
                                
                              });
                            </script>
                                <div class="titlevideo">
                        <p><span class="c_play_left"></span>'. $video_name .'<span class="c_play_right"></span></p>
                    </div>'; 
           return $this->getResponse()->setContent($html);
        }
        
    }
  
    
}